import "@/assets/global.scss";
import "@/assets/style.scss";
import "@/vant";

import Vue from "vue";
Vue.config.productionTip = false;

// ------------过滤器-------------------
Vue.filter("bankStatus", function(status: String) {
    let statusName = "";
    switch (status) {
        case "01":
            statusName = "正常";
            break;
        case "02":
            statusName = "冻结";
            break;
        case "03":
            statusName = "其他异常";
            break;
        case "99":
            statusName = "未知";
            break;
        default:
            statusName = "未知";
            break;
    }
    return statusName;
});

// 银行卡类型
Vue.filter("accountType", function(status: String) {
    let statusName = "";
    switch (status) {
        case "1":
            statusName = "对公";
            break;
        case "2":
            statusName = "对私";
            break;
        default:
            statusName = "-";
            break;
    }
    return statusName;
});

// 业务员状态
Vue.filter("businessStatus", function(status: String) {
    let statusName = "";
    switch (status) {
        case "00":
            statusName = "未认证";
            break;
        case "00":
            statusName = "已认证";
            break;
        default:
            statusName = "-";
            break;
    }
    return statusName;
});
// -------------------------------

// 网络请求
import HTTP from "@/utils/http";
Vue.prototype.$http = HTTP;

// 格式校验
import Check from "@/utils/check";
const _check = new Check();
Vue.prototype.$check = _check;

// 本地存储
import DB from "@/utils/localStorage";
Vue.prototype.$db = DB;

// bridge
import Bridge from "@/utils/bridge";
Vue.prototype.$bridge = Bridge;

// 导航栏
import NavBar from "@/components/navbar/nav-bar.vue";
Vue.component("NavBar", NavBar);

import Config from "@/config";
Vue.prototype.$config = Config;

import VueClipboard from "vue-clipboard2";
Vue.use(VueClipboard);
// =====================
// 初始化
// =====================
import Store from "@/store";
import LS from "@/utils/localStorage";
import Request from "@/utils/request";

Request.setHeader(Store.state.staticInfo);

// 初始化userinfo
const _userinfo = LS.get("USERINFO");
_userinfo && Store.commit("setUserInfo", _userinfo);
// 初始化基本数据源相关
const _basedata = LS.get("BASEDATA");
_basedata && Store.commit("setBaseData", _basedata);
// 初始化首页数据
const _homedata = LS.get("HOMEDATA");
_homedata && Store.commit("setHomeData", _homedata);

// 刷新基本数据源相关
Store.dispatch("getDicData");
// 刷新首页数据
Store.dispatch("getHomeData");

// =====================
// =====================
// =====================
